package com.albaba.designpattern.composite.text_002;

/**
 * @Description: TODO
 * @Author zx
 * @Date 2025/2/21 15:07
 * @Version 1.0
 */
public class Client {

    public static void main(String[] args) {
        // 创建根节点
        Directory root = new Directory("root");

        // 创建树枝节点
        Directory bin = new Directory("bin");

        // 向bin目录添加叶子节点
        bin.add(new File("vim", 1000));
        bin.add(new File("emacs", 2000));

        Directory tmp = new Directory("tmp");
        Directory usr = new Directory("usr");
        Directory etc = new Directory("etc");

        usr.add(new File("core", 5000));
        etc.add(new File("hello.c", 1000));
        tmp.add(usr);
        tmp.add(etc);
        root.add(bin);


        root.printList("");

    }

}
